package etc.spec.ytt.week09.homework;

import java.util.ArrayList;
import java.util.List;

public class Dog extends  Animal implements IPet {
    public Dog() {

    }

    public Dog(String name, List sounds, List foods) {
    super(name,sounds,foods);
    }

    @Override
    public void cry() {
        List l = super.getSounds();
        for (int i = 0; i < l.size(); i++) {
            String s = (String) l.get(i);//强制类型转换
            System.out.println(getName() + "叫声是" + s);
        }
    }

    public static void main(String[] args, List foods) {
        List sounds = new ArrayList();
        sounds.add("wang1");
        sounds.add("wang2");
        sounds.add("wang3");
        List Foods = new ArrayList();
        Dog d = new Dog("jinmao", sounds, foods);
        d.cry();
    }
}

